<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{{if $type==0}}
<title>wish创建新商品</title>
{{/if}}
{{if $type==1}}
<title>wish编辑商品</title>
{{/if}}

<body class="withvernav">
<div class="bodywrapper">
 {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
    
        <div class="pageheader notab">
        {{if $type==0}}
            <h1 class="pagetitle">wish创建新商品</h1>
        {{/if}}
        {{if $type==1}}
            <h1 class="pagetitle">wish编辑商品</h1>
        {{/if}}
            <span class="pagedesc"></span>
            
        </div><!--pageheader-->
        <div id="contentwrapper" class="contentwrapper">
        	
        	<div id="basicform" class="subcontent">
           {{foreach from=$productlist item=li key=key}}
					<form class="stdform stdform2" method="post" action="/management/doShopsAuth">
                    	<p>
                        	<label>Parent_Unique_ID *</label>
                            <span class="field"><input type="text" name="Parent_Unique_ID" id="Parent_Unique_ID" value="{{$li.Parent_Unique_ID}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Unique_ID *</label>
                            <span class="field"><input type="text" name="Unique_ID" id="Unique_ID" value="{{$li.Unique_ID}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Product_Name *</label>
                            <span class="field"><input type="text" name="Product_Name" id="Product_Name" value="{{$li.Product_Name}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Color </label>
                            <span class="field"><input type="text" name="Color" id="Color" value="{{$li.Color}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Size </label>
                            <span class="field"><input type="text" name="Size" id="Size" value="{{$li.Size}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Quantity *</label>
                            <span class="field"><input type="text" name="Quantity" id="Quantity" value="{{$li.Quantity}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Tags *</label>
                            <span class="field"><input type="text" name="Tags" id="Tags" value="{{$li.Tags}}" class="longinput" /></span>
                        </p>
                                                <p>
                            <label>Description *</label>
                            <span class="field"><input type="text" name="Description" id="Description" value="{{$li.Description}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>MSRP </label>
                            <span class="field"><input type="text" name="MSRP" id="MSRP" value="{{$li.MSRP}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>Price *</label>
                            <span class="field"><input type="text" name="Price" id="Price" value="{{$li.Price}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>Shipping *</label>
                            <span class="field"><input type="text" name="Shipping" id="Shipping" value="{{$li.Shipping}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>Product_Page </label>
                            <span class="field"><input type="text" name="Product_Page" id="Product_Page" value="{{$li.Product_Page}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>Main_Image_URL *</label>
                            <span class="field"><input type="text" name="Main_Image_URL" id="Main_Image_URL" value="{{$li.Main_Image_URL}}" class="longinput" /></span>
                        </p>
                                                                                                <p>
                            <label>Extra_Image_URL </label>
                            <span class="field"><input type="text" name="Extra_Image_URL" id="Extra_Image_URL" value="{{$li.Extra_Image_URL}}" class="longinput" /></span>
                        </p>
                                                                        <p>
                            <label>Shipping_Time </label>
                            <span class="field"><input type="text" name="Shipping_Time" id="Shipping_Time" value="{{$li.Shipping_Time}}" class="longinput" /></span>
                        </p>

                        <p class="stdformbutton">
                        {{if $type==0}}
                            <button type="button" class="submit radius2" onClick="saveform({{$type}})">Submit Button</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                         {{if $type==1}}
                         <button type="button" class="submit radius2" onClick="saveform({{$type}},{{$li.wish_id}})">Submit Button</button>&nbsp;&nbsp;&nbsp;
                        {{/if}}
                        	
                             
                        </p>

                    </form>
			{{/foreach}}		
                    <br />

            </div><!--subcontent-->
            
        
        </div><!--contentwrapper-->
        
	</div><!-- centercontent -->
    
    
</div><!--bodywrapper-->

</body>
<script language="javascript">
function saveform(type,id)
{


	if($("#Product_Name").val()=="")
	{
		alert("商品名称不能为空！");
		return false;	
	}
	if($("#Description").val()=="")
	{
		alert("商品描述不能为空！");	
		return false;
	}
	if($("#Tags").val()=="")
	{
		alert("标签不能为空！");	
		return false;
	}
	   if($("#Unique_ID").val()=="")
    {
        alert("id不能为空！");
        return false;   
    }
    if($("#Quantity").val()=="")
    {
        alert("数量不能为空！");    
        return false;
    }
    if($("#Price").val()=="")
    {
        alert("价格不能为空！");  
        return false;
    }
        if($("#Shipping").val()=="")
    {
        alert("运输不能为空！");
        return false;   
    }
    if($("#Main_Image_URL").val()=="")
    {
        alert("商品图片不能为空！");    
        return false;
    }
    
	$.post("/wishproduct/ajaxbutton", {"op": "saveproduct","type":type,"id":id,"Parent_Unique_ID":$("#Parent_Unique_ID").val(),"Unique_ID":$("#Unique_ID").val(),"Product_Name":$("#Product_Name").val(),"Color":$("#Color").val(),"Size":$("#Size").val(),"Quantity":$("#Quantity").val(),"Tags":$("#Tags").val(),"Description":$("#Description").val(),"MSRP":$("#MSRP").val(),"Price":$("#Price").val(),"Shipping":$("#Shipping").val(),"Product_Page":$("#Product_Page").val(),"Main_Image_URL":$("#Main_Image_URL").val(),"Extra_Image_URL":$("#Extra_Image_URL").val(),"Shipping_Time":$("#Shipping_Time").val()},
		function(data){
            document.location.href = data;
		}); 
}
</script>
</html>
